package org.project.product.android.pfe_fanta;

import org.project.product.android.pfe.fanta.R;
import org.project.product.android.pfe.fanta.adapter.DataManagerFacade;
import org.project.product.android.pfe.fanta.domain.User;
import org.project.product.android.pfe.fanta.util.Utils;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class ForgotHelp extends Activity {

	private EditText eanInput;

	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		this.setContentView(R.layout.forgot_password);
		eanInput = (EditText) findViewById(R.id.entryEAN);

	}

	public void checkCodePin(View v) {
		if (Utils.checkEditText(this, eanInput)) {
			String ean = eanInput.getText().toString();
			User user = DataManagerFacade.getInstance(this)
			        .retrieveUserByCodePin(ean);
			if (user == null) {
				Toast.makeText(this, "No user Matching", Toast.LENGTH_SHORT)
				        .show();
			} else {
				Utils.lancerActivity(this, EditUserActivity.class, user);
				finish();
			}

		}
	}

	@Override
	protected void onPause() {
		super.onPause();
		finish();
	}
}
